<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0 user-scalable=no">
    <title>芳小微宣</title>
    <link rel="stylesheet" href="css/dropload.css">
    <script src="js/jquery.min.js"> </script>
    <script src="js/dropload.min.js"></script>
    <script src="js/index.js"></script>
    <link rel="stylesheet" href="css/index.css">
    <style>
        .dropload-down {
            width: 100%;
            height: 50px;
        }
        .yuyue{
            width: 65px;
            position: relative;
            bottom: 9px;
            left: 8px;
            background: #3b9ddd;
            height: 30px;
            color: #fff;
            border: 0px;
            border-radius: 5px;
            font-size: 5rem;
        }
    </style>
</head>
<body class="tzggPage">
<div class="weui_cells_title">基地列表</div>
<div class="listAll">
    <div class="content">
       <!-- <div class="imgSin">
            <a>
                <div class="Photo_left"><img src="images/address.png"/></div>
                <div class="Photo_right">
                    <span class="wordSin" style="padding-top: 8px;width: 70%;">的风范热的风范热的风范热的风范热的风范热</span>
                    <button class="yuyue">预约</button>
                </div>
            </a>
        </div>-->
    </div>
</div>
<div class="btnChoose">
    <div id="returnIndex">
        <img src="images/return.png" style="width: 25px;padding-top: 5px;"><br>
        <span>返回</span>
    </div>
    <div style="visibility: hidden;">
        <img src="images/add.png" id="addNew" style="width: 55px;position: relative;top: -12px;">
    </div>
    <div id="Myorder">
        <img src="images/order.png" style="width: 25px;padding-top: 5px;"><br>
        <span>已预约</span>
    </div>
</div>
<script>
    $(function(){
        // 页数
        var page = 0;
        // 每页展示10个
        var size = 10;
        // dropload
       $('.listAll').dropload({
            scrollArea : window,
            loadDownFn : function(me){
                page++;
                // 拼接HTML
                var result = '';
                $.ajax({
                    type: 'GET',
                    url: path + '/api/weixin/getEduBaseInfo?page='+page+'&size='+size+'&token='+window.localStorage.getItem("token"),
                    dataType: 'json',
                    success: function(data){
                        if(data.code == 501){
                            window.location.href = "login.html";
                            return;
                        }
                        var arrLen = data.eduInfoList.length;
                        if(arrLen > 0){
                                for(var i=0; i<arrLen; i++){
                                    result += ' <div class="imgSin"><a><div class="Photo_left"><img src="images/address.png"/></div>' +
                                            '<div class="Photo_right"><span class="wordSin" style="padding-top: 8px;width: 70%;" title="'+ data.eduInfoList[i].id +'">'+ data.eduInfoList[i].eduName +'</span>' +
                                            ' <button class="yuyue" title="'+ data.eduInfoList[i].id +'" author="' + data.eduInfoList[i].createBy + '" eduName="' + data.eduInfoList[i].eduName + '">预约</button> </div> </a></div>';
                                }
                        }else{
                            // 如果没有数据
                            // 锁定
                            me.lock();
                            // 无数据
                            me.noData();
                        }
                        // 插入数据到页面，放到最后面
                        $('.content').append(result);
                        // 每次数据插入，必须重置
                         me.resetload();

                        $(".yuyue").click(function(){
                            window.location.href = "jdyy.html?id=" + $(this).attr("title") + "&eduname=" + $(this).attr("eduName");
                        });
                    },
                    error: function(xhr, type){
                        // 即使加载出错，也得重置
                        me.resetload();
                    }
                });
            }
        });
    });

    var deleList = [];
    $(".content").on('click','.imgCheck',function(){
        if($(this).attr("src").indexOf("selected")>0){
            $(this).attr("src","images/noselect.png");
        }else {
            $(this).attr("src","images/selected.png");
        }
    });
    $(".content").on('click','.wordSin',function(){
        window.location.href = "jdyyDetail.html?id=" + $(this).attr("title");
    });

    $("#returnIndex").click(function(){
        window.location.href = "index.html";
    });
    $("#Myorder").click(function(){
        window.location.href = "myOrder.html";
    });
</script>
</body>
</html>